VersionNum = .1
LastUpdate$ = "February 2, 2010"
print "Welcome to Ravenholm, version "; VersionNum
print "Copyright 2009 by Matt Petrole"
print "Last updated "; LastUpdate$
[start]
cls
input "1 = new game 2 = load game  3 = about  4 = exit "; MenuOption 'this sets up the menu
if MenuOption = 1 then goto [PlayerName]
if MenuOption = 2 then goto [load]
if MenuOption = 3 then goto [about]
if MenuOption = 4 then goto [quit]
cls
goto [start]
[PlayerName]
Print "Remember, everything must be typed exactly as it is shown."
input "Press enter to continue"; dummyvar
Input "What shall you be called? "; playername$
print ""
[namecheck]
Print playername$
Input "Did I get that right? Y or N? "; YorN$
If YorN$ = "N" then goto [PlayerName]
If YorN$ = "Y" then goto [character]
print "Please enter Y for yes or N for no." 'make sure they enter valid data
print ""
goto [namecheck]

[load]
open "save.dat" for input as #character
if eof(#character) = -1 then print "Error reading from save file..."
if eof(#character) = -1 then input "Press enter to continue"; dummyvariable
if eof(#character) = -1 then close #character
if eof(#character) = -1 then goto [start]
input #character, strength
input #character, stamina
input #character, dexterity
input #character, wisdom
input #character, charisma
input #character, playername$
input #character, characterclass$
input #character, playerdamage
input #character, playerhealth
input #character, playerhit
input #character, playermana
input #character, currentloc
input #character, hasrdagger
input #character, gotrdagger
input #character, weaponname$
close #character
print "Welcome back, "; playername$; ". Press enter to continue..."
input ""; dummyvariable
cls
goto [playstart]



[character]
cls
' This part sets up your character
helm$ = "none"
gloves$ = "none"
bracers$ = "none"
chest$ = "none"
legs$ = "none"
boots$ = "none"
cape$ = "none"
weaponname$ = "none"
' Starting stats
strength = 15
stamina = 12
dexterity = 10
willpower = 10
charisma = 5

[charactergeneration]
print "Your stats are:"
strengthx = strength + int(rnd(1)*5)+1
print "strength: "; strengthx
staminax = stamina + int(rnd(1)*10)+1
print "stamina: "; staminax
dexterityx = dexterity + int(rnd(1)*5)+1
print "dexterity: "; dexterityx
wisdomx = wisdom + int(rnd(1)*6)+1
print "wisdom: "; wisdomx
charismax = charisma + int(rnd(1)*2)+1
print "charisma: "; charismax
input "is this acceptable, Y or N? "; GoodCharacter$
if GoodCharacter$ = "N" goto [charactergeneration]
if GoodCharacter$ = "Y" goto [class]
[charloop]
input "Please enter a 'Y' or an 'N'! "; stupid$
if stupid$ = "Y" goto [class]
if stupid$ = "N" goto [charactergeneration]
goto [charloop]


[class]
'resets stats to match new stats
strength = strengthx
stamina = staminax
dexterity = dexterityx
wisdom = wisdomx
charisma = charismax

'character classes
input "Please choose a class. Options are Warrior, Rogue, Mage, and Priest. "; chooseClass$
if chooseClass$ = "Warrior" goto [warriordesc]
if chooseClass$ = "Rogue" goto [roguedesc]
if chooseClass$ = "Mage" goto [magedesc]
if chooseClass$ = "Priest" goto [priestdesc]
goto [class]

'class descriptions
[warriordesc]
print "The warrior is a fearsome fighter in close-range combat,"
print "cutting weaker foes down in a single swing. He is able"
print "to use almost any non-magic weapon, and can wear the"
print "formidable plate armor. Gains great strength at the cost"
print "of no magical ability at all."
print
input "Is this the class you want to be? "; YorN$
if YorN$ = "Y" goto [warrior]
goto [class]

[roguedesc]
print "The rogue is the most versatile, prefering to kill"
print "before his opponent even knows he is there, but is"
print "certainly not afraid to get toe-to-toe if the situation"
print "requires it. Can blend in with the shadows and sneak"
print "unseen. Dexterity is a rogue's best friend."
print
input "Is this the class you want to be? "; YorN$
if YorN$ = "Y" goto [rogue]
goto [class]

[magedesc]
print "The mage is the master of the arcane, bending the"
print "elements to his will. While weak physically, he"
print "knows that a strong mind can best the most"
print "impossible of tasks. A wise mage can overpower"
print "the strongest warrior."
print
input "Is this the class you want to be? "; YorN$
if YorN$ = "Y" goto [mage]
goto [class]

[priestdesc]
print "The priest is a harbringer of balance, whether good or evil."
print "His sole purpose in life is to keep the order of the cosmos"
print "and make sure neither side of the spectrum becomes too powerful."
print "Wielding either holy or evil powers as the situation requires,"
print "he can become a force to be reckoned with through constant"
print "meditation."
print
input "Is this the class you want to be? "; YorN$
if YorN$ = "Y" goto [priest]
goto [class]


[warrior] 'these set up the new stats, which are different for each class
characterclass$ = "Warrior"
strengthmod = int(strength * 1.5)
staminamod = int(stamina * 2)
dexteritymod = int(dexterity * 1)
wisdommod = int(wisdom * 0.8)
goto [newstats]

[rogue]
characterclass$ = "Rogue"
strengthmod = int(strength * 0.7)
staminamod = int(stamina * 0.8)
dexteritymod = int(dexterity * 2.5)
wisdommod = int(wisdom * 1.2)
goto [newstats]

[mage]
characterclass$ = "Mage"
strengthmod = int(strength * 0.5)
staminamod = int(stamina * 0.5)
dexteritymod = int(dexterity * 1)
wisdommod = int(wisdom * 4.2)
goto [newstats]

[priest]
characterclass$ = "Priest"
strengthmod = int(strength * 0.4)
staminamod = int(stamina * 1.1)
dexteritymod = int(dexterity * 0.7)
wisdommod = int(wisdom * 3.8)
goto [newstats]

[newstats]
strength = strengthmod
stamina = staminamod
dexterity = dexteritymod
wisdom = wisdommod
'Character attack stats
baseattack = 1
basehealth = 20
basehit = .75
basemana = 10
playerdamage = int(strength * baseattack)
playerhealth = stamina + basehealth
playerhit = dexterity * .01 + basehit
if playerhit > 1 then playerhit = 1
playermana = wisdom + basemana
print "Your class brings your stats to:"
print "strength: "; strength
print "stamina: "; stamina
print "dexterity: "; dexterity
print "wisdom: "; wisdom
print ""
input "Press enter to continue..."; dummyvariable
cls
goto [playstart]

[playstart]
if currentloc = 1 then goto [townsquare]
if currentloc = 2 then goto [northroad]
if currentloc = 3 then goto [southroad]
if currentloc = 4 then goto [eastroad]
if currentloc = 5 then goto [westroad]
if currentloc = 6 then goto [crossing]
if currentloc = 7 then goto [slums1]
if currentloc = 8 then goto [eastroad2]
gosub [unarmed]
print "Today is the day your journey begins."
print "May the gods smile upon you"
print "and find favour in your actions..."
input "  v  "; dummyvariable
cls


'Locations number index
'1 = town square, 2 = north road, 3 = south road, 4 = east road, 5 = west road, 6 = crossing,
'7 = slums, 8 = east road 2, 9 = west road 2, 10 = inn, 11 = junkyard 12 = east gate, 13 = west gate





[townsquare]
currentloc = 1
gonorth = 1
gosouth = 1
goeast = 1
gowest = 1
godown = 0
goup = 0
rusteddagger = 1
if gotrdagger = 1 then rusteddagger = 0
print "Here you are in the town square. You see a large tree in the center,"
print "and streets branch out in each of the cardinal directions."
print "Type help if you are stuck."
print ""
if rusteddagger = 1 then print "You see a rusted dagger lying on the ground here."
print ""
input "What would you like to do? "; action$ 
if action$ <> "" then gosub [action]
cls
goto [townsquare]

[northroad]
currentloc = 2
gonorth = 0
gosouth = 1
goeast = 0
gowest = 0
godown = 0
goup = 0
rusteddagger = 0
print "You are on a road heading north from the townsquare."
print "There are buildings to both sides and a crossroad to the north."
print ""
print ""
input "What would you like to do? "; action$
if action$ <> "" then gosub [action]
cls
goto [northroad]

[southroad]
currentloc = 3
gonorth = 1
gosouth = 0
goeast = 0
gowest = 0
godown = 0
goup = 0
rusteddagger = 0
mobspawn = rnd(1)
print "This road leads south to the poor section of town."
print "Shanties block you in on the east and west."
print ""
if mobspawn > .5 then print "You see a begger here on the side of the road."
if mobspawn > .5 then mobtype$ = "begger" and MobHealth = 50 and MobDamage = int(rnd(1)*3)+1
'mob hit is .5
print ""
input "What would you like to do? "; action$
if action$ <> "" then gosub [action]
cls
goto [southroad]

[eastroad]
currentloc = 4
gonorth = 0
gosouth = 0
goeast = 1
gowest = 1
godown = 0
goup = 0
mobspawn = rnd(1)
print "The road leads east for a while, and at the end"
print "you can see a gate. Houses block your travel north,"
print "and shanties block your southward travel."
print ""
if mobspawn > .7 then print "You see a town guard here."
if mobspawn > .7 then mobtype$ = "town guard"
print ""
input "What would you like to do? "; action$
if action$ <> "" then gosub [action]
cls
goto [eastroad]

[westroad]
currentloc = 5
gonorth = 1
gosouth = 0
goeast = 1
gowest = 0
goup = 0
godown = 0
print "This road leads west to a large gatehouse, and"
print "is defined as being rather nice. To the north"
print "you will find the armor/weapon shops."
print ""
print ""
input "What would you like to do? "; action$
if action$ <> "" then gosub [action]
cls
goto [westroad]

[crossing]
currentloc = 6
gonorth = 1
gosouth = 1
goeast = 1
gowest = 1
goup = 0
godown = 0
print "Here is an intersection of two roads; the one"
print "you are on leading south, and the other leading east and west."
print "To the north, you see a door leading to a tavern named"
print "'The Rusty Sword.'"
input "What would you like to do? "; action$
if action$ <> "" then gosub [action]
cls
goto [crossing]

[slums1]
currentloc = 7
gonorth = 1
gosouth = 0
goeast = 0
gowest = 0
goup = 0
godown = 0
mobspawn = rnd(1)
print "You are in the slums of the city, all around"
print "you see trash and filth. This is truly the depths"
print "of poverty and despair."
if mobspawn > .75 then print "You see a filthy peon here."
if mobspawn > .75 then mobtype$ = "filthy peon"
input "What would you like to do? "; action$
if action$ <> "" then gosub [action]
cls
goto [slums1]


[eastroad2]
currentloc = 8
gonorth = 0
gosouth = 0
goeast = 0
gowest = 1
goup = 0
godown = 0
mobspawn = rnd(1)
print "You continue on the road heading east. Directly"
print "to the east, you see a gate leading out of the city."
print "Buildings block your progress north or south."
if mobspawn > .30 then print "You see a city guard keeping the peace."
if mobspawn > .30 then mobtype$ = "city guard"
input "What would you like to do? "; action$
if action$ <> "" then gosub [action]
cls
goto [eastroad2]

[westroad2]
currentloc = 9
gonorth = 0
gosouth = 0
goeast = 1
gowest = 0
goup = 0
godown = 0
mobspawn = rnd(1)
print 


[action]
print action$
if action$ = "look" then gosub [look]
if action$ = "north" then gosub [north]
if action$ = "south" then gosub [south]
if action$ = "east" then gosub [east]
if action$ = "west" then gosub [west]
if action$ = "help" then gosub [help]
if action$ = "inventory" then gosub [inventory]
if action$ = "get" then gosub [get]
if action$ = "equip" then gosub [equip]
if action$ = "quit" then goto [quit]
if action$ = "exit" then goto [quit]
if action$ = "0" then return
print "I'm sorry, but I don't understand. Type help if you are stuck."
return

[inventory]
print "You are currently holding:"
if hasrdagger = 1 then print "Rusted Dagger"
input ""; dummyvariable
action$ = "0"
return

[equip]
input "Equip what? "; equipvar$
if equipvar$ = "rusted dagger" then gosub [rusteddagger]
if equipvar$ = "null" then return
print "You don't seem to have a "; equipvar$
input ""; dummyvariable
print""
return

[attack]
input "attack what? "; attackmob$
if attackmob$ = "begger" and mobtype$ = "begger" then goto [beggerfight]
print "I don't see what you want to fight!"
action$ = "0"
return

[beggerfight]
call Pause 5000 'battle will tic every 5 seconds
 


[help]
print "Valid actions include 'look' 'inventory' 'attack'"
print "'equip' 'up' 'down' 'east' 'west' 'south' and 'north'"
print "The commands must be input with all lower case letters"
print "and can not have any spaces."
print "The key word must be input first, then the target can be entered."
print "Try typing 'look' without the apostraphies and see what happens."
action$ = "0"
input "..."; dummyvariable
return

[look]
input "Look at what? "; lookvar$
if lookvar$ = "rusted dagger" and rusteddagger = 1 or hasrdagger = 1 then print "It is rather old, yet still effective."
if lookvar$ = "rusted dagger" and rusteddagger = 1 or hasrdagger = 1 then input ""; dummyvariable
if lookvar$ = "rusted dagger" and rusteddagger = 1 or hasrdagger = 1 then return
if lookvar$ = "self" then gosub [lookself]
if lookvar$ = "null" then return
input "I don't see that here..."; dummyvariable
action$ = "0"
return

[get]
input "Get what? "; getvar$
if getvar$ = "rusted dagger" and rusteddagger = 1 then gotrdagger = 1
if gotrdagger = 1 then hasrdagger = 1
if getvar$ = "rusted breastplate" and rustedbplate = 1 then gotrbplate = 1
if gotrbplate = 1 then hasrbplate = 1
action$ = "0"
return

[north]
if gonorth <> 1 then print "You can't go that way, silly!"
if gonorth <> 1 then input ""; dummyvariable
if gonorth <> 1 then return
if currentloc = 1 then goto [northroad]
if currentloc = 3 then goto [townsquare]
if currentloc = 7 then goto [southroad]

[south]
if gosouth <> 1 then print "You can't go that way, silly!"
if gosouth <> 1 then input ""; dummyvariable
if gosouth <> 1 then return
if currentloc = 1 then goto [southroad]
if currentloc = 2 then goto [townsquare]
if currentloc = 3 then goto [slums1]

[east]
if goeast <> 1 then print "You can't go that way, silly!"
if goeast <> 1 then input ""; dummyvariable
if goeast <> 1 then return
if currentloc = 1 then goto [eastroad]
if currentloc = 4 then goto [eastroad2]
if currentloc = 5 then goto [townsquare]

[west]
if gowest <> 1 then print "You can't go that way, silly!"
if gowest <> 1 then input ""; dummyvariable
if gowest <> 1 then return
if currentloc = 1 then goto [westroad]
if currentloc = 4 then goto [townsquare]
if currentloc = 8 then goto [eastroad]

'your eqquipped items
[lookself]
print "You currently have eqquipped:"
print "Weapon: "; weaponname$
print "Helm: "; helm$
print "Gloves: "; gloves$
print "Bracers: "; bracers$
print "Chest: "; chest$
print "Legs: "; legs$
print "Boots: "; boots$
print "Cape: "; cape$
input "Press enter to return."; dummyvariable
lookvar$ = "null"
cls
return


'weapons
[unarmed]
weaponname$ = "Fists"
damagemod = 1
speedmod = 1
return

[rustedsword]
if equipvar$ = "null" then return
equipvar$ = "null"
if characterclass$ = "Rogue" then gosub [wrongclass]
if characterclass$ = "Preist" then gosub [wrongclass]
if hasrsword <> 1 then print "You don't have a rusted sword!"
if hasrsword <> 1 then return
hasrsword = 0
weaponname$ = "Rusted Sword"
damagemod = 1.2
speedmod = 1
return

[rustedmace]
if equipvar$ = "null" then return
equipvar$ = "null"
if characterclass$ = "Mage" then gosub [wrongclass]
if hasrmace <> 1 then print "You don't have a blunt mace!"
if hasrmace <> 1 then return
hasrmace = 0
weaponname$ = "Blunt Mace"
damagemod = 1.3
speedmod = .8
return

[rusteddagger]
if equipvar$ = "null" then return
equipvar$ = "null"
if characterclass$ = "Priest" then gosub [wrongclass]
if characterclass$ = "Mage" then gosub [wrongclass]
if hasrdagger <> 1 then print "You don't have a rusted dagger!"
if hasrdagger <> 1 then return
hasrdagger = 0
weaponname$ = "Rusted Dagger"
damagemod = 1.2
speedmod = 1.2
return

[wrongclass]
print "You don't seem to be able to use that."
equipvar$ = "null"
input ""; dummyvariable
cls
return

'armor
[rustedbreastplate]
if equipvar$ = "null" then return
equipvar$ = "null"
if characterclass$ = "Priest" then gosub [wrongclass]
if characterclass$ = "Mage" then gosub [wrongclass]
if hasrbplate <> 1 then print "You don't have a rusted breastplate!"
if hasrbplate <> 1 then return
hasrbplate = 0
chest$ = "Rusted Breastplate"
pdamagemod = .9 'these make the player do less damage and attack slower when wearing armor.
speedmod = .95
return



[about]
cls
print "Ravenholm, the text-based adventure (c) 2009"
print "Started December 29, 2009"
print "last updated "; LastUpdate$
print "Version "; VersionNum
print "I wrote this with Just BASIC by Shoptalk Systems. Thanks go to them for the software base."
print ""
print "If you ever need help in game, just type 'help'."
print ""
print "This is my first attempt at BASIC, I hope that it is a decent game."
print ""
print "Some common commands include directions - North, South, East, West, Up, and Down - "
print "as well as Look, Kill, Equip, and Sleep."
print ""
print "Kill stuff to get experience and level up."
print "But be careful, because not everything will be a pushover."
print ""
print "Hope you have fun!"
print ""
input "Press enter to continue"; dummyvariable
cls
goto [start]

sub Pause mil
    t=time$("milliseconds")
    while time$("milliseconds")<t+mil
    wend
    end sub


[quit]
open "save.dat" for output as #character 'saves character
print #character, strength
print #character, stamina
print #character, dexterity
print #character, wisdom
print #character, charisma
print #character, playername$
print #character, characterclass$
print #character, playerdamage
print #character, playerhealth
print #character, playerhit
print #character, playermana
print #character, currentloc
print #character, hasrdagger
print #character, gotrdagger
print #character, weaponname$
close #character
end






















































































































